fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
# Store all results
effects_pray<-all_reg %>% ggplot(aes(x=outcome, y=coef)) + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="Respondents pray frequently") + coord_flip() + scale_colour_ordinal("Treatment") + theme(legend.position = "none")
# Do not pray often
data_pray<-data %>% filter(!is.na(pray_freq))  %>% filter(pray_often==0)
fit1<-lm(id_binary ~ treat_pool , data=data_pray[!data_pray$treat_pool=="Superordinate",])
fit2<-lm(religion_binary ~ treat_pool, data=data_pray[!data_pray$treat_pool=="Superordinate",]) #religion
fit3<-lm(ethnic_binary ~ treat_pool, data=data_pray[!data_pray$treat_pool=="Superordinate",]) #ethnicity
fit4<-lm(foreign_binary ~ treat_pool, data=data_pray[!data_pray$treat_pool=="Superordinate",]) #foreigners
fit5<-lm(concern_binary ~ treat_pool, data=data_pray[!data_pray$treat_pool=="Superordinate",])
fit6<-lm(message_binary ~ treat_pool, data=data_pray[!data_pray$treat_pool=="Superordinate",])
fit7<-lm(trust_rel_binary ~ treat_pool, data=data_pray[!data_pray$treat_pool=="Superordinate",])
fit8<-lm(trust_eth_binary ~ treat_pool, data=data_pray[!data_pray$treat_pool=="Superordinate",])
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
effects_no_pray<-all_reg %>% ggplot(aes(x=outcome, y=coef)) + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="Respondents pray infrequently") + coord_flip() + scale_colour_ordinal("Treatment") + theme(axis.text.y = element_blank(), legend.position = "right")
# Combine two plots
grid.arrange(effects_pray, effects_no_pray, nrow=1, ncol=2, widths = 5:4 )
# H9: Treatment effects for messages invoking super-ordinate identity will be larger for respondents that have had more contact with members of different out-groups.
data_out<-data %>% filter(out_exposure==1)
data_in<-data %>% filter(out_exposure==0)
# Those that have contact with out group
fit1<-lm(id_binary ~ treat_binary, data=data_out)
fit2<-lm(religion_binary ~ treat_binary, data=data_out) #religion
fit3<-lm(ethnic_binary ~ treat_binary, data=data_out) #ethnicity
fit4<-lm(foreign_binary ~ treat_binary, data=data_out) #foreigners
fit5<-lm(concern_binary ~ treat_binary, data=data_out)
fit6<-lm(message_binary ~ treat_binary, data=data_out)
fit7<-lm(trust_rel_binary ~ treat_binary, data=data_out)
fit8<-lm(trust_eth_binary ~ treat_binary, data=data_out)
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
het_out<-all_reg %>% ggplot(aes(x=outcome, y=coef))  + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="Out-groups in neighborhood") + coord_flip() + scale_colour_ordinal("Treatment", begin=.2) + theme(legend.position = "none")
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
het_out<-all_reg %>% ggplot(aes(x=outcome, y=coef))  + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="Out-groups in neighborhood") + coord_flip() + scale_colour_ordinal("Treatment", begin=.2) + theme(legend.position = "none")
# Those that have contact with in group only
fit1<-lm(id_binary ~ treat_binary, data=data_in)
fit2<-lm(religion_binary ~ treat_binary, data=data_in) #religion
fit3<-lm(ethnic_binary ~ treat_binary, data=data_in) #ethnicity
fit4<-lm(foreign_binary ~ treat_binary, data=data_in) #foreigners
fit5<-lm(concern_binary ~ treat_binary, data=data_in)
fit6<-lm(message_binary ~ treat_binary, data=data_in)
fit7<-lm(trust_rel_binary ~ treat_binary, data=data_in)
fit8<-lm(trust_eth_binary ~ treat_binary, data=data_in)
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
het_in<-all_reg %>% ggplot(aes(x=outcome, y=coef))  + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="Neighborhood only in-groups") + coord_flip() + scale_colour_ordinal("Treatment", begin=.2) + theme(axis.text.y = element_blank())
grid.arrange(het_out, het_in, nrow=1, ncol=2, widths = 5:4)
# The only variables we use
gns_data<-data_bad
gns_data<-rename(gns_data,  attention_fail=s0q001)
gns_data<-rename(gns_data,location=s0q01)
gns_data<-rename(gns_data,id_strength=s8q01)
gns_data<-rename(gns_data,nb_relig=s8q02_1)
gns_data<-rename(gns_data,nb_eth=s8q02_2)
gns_data<-rename(gns_data,nb_foreign=s8q02_3)
gns_data<-rename(gns_data,concern=s8q04)
gns_data<-rename(gns_data,pray_freq=s1q09)
gns_data %<>% filter(!is.na(s2q01)) %>% mutate(out_exposure=ifelse(grepl("your ethnic", s2q01), 0, 1))
keep<-c("location","treat","treat_binary","religion_binary","ethnic_binary","trust_rel_binary","trust_eth_binary","attention_fail",
"concern_binary","justified_binary","message_binary","msg_gov","msg_islamic","eth", "religion",
"Muslim", "Ouaga","Girl","laws_qran" ,"pray_often","relig_important","violence_exp","violence_heard",
"join_econ","econ_hh","diff_eth","diff_relig","age",
"id_strength", "nb_relig", "nb_eth", "nb_foreign","violence_justified","concern", "id_binary", "foreign_binary","violence_exp",
"id","neighbor_relig","neighbor_eth","neighbor_foreign","trust_other_relig","trust_other_eth","treat_pool",
"pray_often","pray_freq","out_exposure")
gns_data<-subset(gns_data,select=keep)
gns_data$sample <- "Main" #add variable that indicates this is the main sample
write_csv(gns_data,"gns_jeps_main.csv")
#data2<-read_csv("gns_jeps_sample2.csv")
#data2$sample <- "Replication"  #add variable that indicates this is the replication sample
#data2$location<- "KENEDOUGOU"
#keep<-c("treat","eth",
#        "Muslim","Girl","laws_qran" ,"pray_often","relig_important","violence_exp","violence_heard",
#        "join_econ","econ_hh","diff_eth","diff_relig","age")
#gns_data2<-subset(data2,select=keep)
#write_csv(gns_data2,"gns_jeps_sample2.csv")
#data2<-read_csv("gns_jeps_sample2.csv")
data_violence<-data %>% filter(violence_exp==1)
fit1<-lm(id_binary ~ treat_binary, data=data_violence)
fit2<-lm(religion_binary ~ treat_binary, data=data_violence) #religion
fit3<-lm(ethnic_binary ~ treat_binary, data=data_violence) #ethnicity
fit4<-lm(foreign_binary ~ treat_binary, data=data_violence) #foreigners
fit5<-lm(concern_binary ~ treat_binary, data=data_violence)
fit6<-lm(message_binary ~ treat_binary, data=data_violence)
fit7<-lm(trust_rel_binary ~ treat_binary, data=data_violence)
fit8<-lm(trust_eth_binary ~ treat_binary, data=data_violence)
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
effects_violence<-all_reg %>% ggplot(aes(x=outcome, y=coef)) + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(title="Exposed to violence", x="", y="") + coord_flip() + scale_colour_ordinal("Treatment") + theme(legend.position = "none")
data_no_violence<-data %>% filter(violence_exp==0)
fit1<-lm(id_binary ~ treat_binary, data=data_no_violence)
fit2<-lm(religion_binary ~ treat_binary, data=data_no_violence) #religion
fit3<-lm(ethnic_binary ~ treat_binary, data=data_no_violence) #ethnicity
fit4<-lm(foreign_binary ~ treat_binary, data=data_no_violence) #foreigners
fit5<-lm(concern_binary ~ treat_binary, data=data_no_violence)
fit6<-lm(message_binary ~ treat_binary, data=data_no_violence)
fit7<-lm(trust_rel_binary ~ treat_binary, data=data_no_violence)
fit8<-lm(trust_eth_binary ~ treat_binary, data=data_no_violence)
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
effects_no_violence<-all_reg %>% ggplot(aes(x=outcome, y=coef)) + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(title="No violence", x="", y="") + coord_flip() + scale_colour_ordinal("Treatment") + theme(axis.text.y = element_blank())
grid.arrange(effects_violence, effects_no_violence, nrow=1, ncol=2, widths = 5:4)
data_young<-data %>% filter(age<15)
data_older<-data %>% filter(age>14)
fit1<-lm(id_binary ~ treat_binary, data=data_young)
fit2<-lm(religion_binary ~ treat_binary, data=data_young) #religion
fit3<-lm(ethnic_binary ~ treat_binary, data=data_young) #ethnicity
fit4<-lm(foreign_binary ~ treat_binary, data=data_young) #foreigners
fit5<-lm(concern_binary ~ treat_binary, data=data_young)
fit6<-lm(message_binary ~ treat_binary, data=data_young)
fit7<-lm(trust_rel_binary ~ treat_binary, data=data_young)
fit8<-lm(trust_eth_binary ~ treat_binary, data=data_young)
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
het_younger<-all_reg %>% ggplot(aes(x=outcome, y=coef))  + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="Age 10-14") + coord_flip() + scale_colour_ordinal("Treatment", begin=.2) + theme(legend.position = "none")
fit1<-lm(id_binary ~ treat_binary, data=data_older)
fit2<-lm(religion_binary ~ treat_binary, data=data_older) #religion
fit3<-lm(ethnic_binary ~ treat_binary, data=data_older) #ethnicity
fit4<-lm(foreign_binary ~ treat_binary, data=data_older) #foreigners
fit5<-lm(concern_binary ~ treat_binary, data=data_older)
fit6<-lm(message_binary ~ treat_binary, data=data_older)
fit7<-lm(trust_rel_binary ~ treat_binary, data=data_older)
fit8<-lm(trust_eth_binary ~ treat_binary, data=data_older)
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
het_older<-all_reg %>% ggplot(aes(x=outcome, y=coef))  + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="Age 15-18") + coord_flip() + scale_colour_ordinal("Treatment", begin=.2) + theme(axis.text.y = element_blank())
grid.arrange(het_younger, het_older, nrow=1, ncol=2, widths = 5:4)
data_muslim<-data %>% filter(religion=="Muslim") #subset to muslim respondents
# Create subgroups
data_mossi<-subset(data,eth=="Mossi")
data_nomossi<-subset(data,eth!="Mossi")
data_14_plus<-subset(data,age>=14)
data_muslims <- subset(data,religion=="Muslim")
data_nonmuslims <- subset(data,religion!="Muslim")
fit1<-lm(id_binary ~ treat_binary, data=data_muslims)
fit2<-lm(religion_binary ~ treat_binary, data=data_muslims) #religion
fit3<-lm(ethnic_binary ~ treat_binary, data=data_muslims) #ethnicity
fit4<-lm(foreign_binary ~ treat_binary, data=data_muslims) #foreigners
fit5<-lm(concern_binary ~ treat_binary, data=data_muslims)
fit6<-lm(message_binary ~ treat_binary, data=data_muslims)
fit7<-lm(trust_rel_binary ~ treat_binary, data=data_muslims)
fit8<-lm(trust_eth_binary ~ treat_binary, data=data_muslims)
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
effects_all_muslims<-all_reg %>% ggplot(aes(x=outcome, y=coef)) + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="Muslim respondents") + coord_flip() + scale_colour_ordinal("Treatment") + theme(legend.position = "none")
fit1<-lm(id_binary ~ treat_binary, data=data_nonmuslims)
fit2<-lm(religion_binary ~ treat_binary, data=data_nonmuslims) #religion
fit3<-lm(ethnic_binary ~ treat_binary, data=data_nonmuslims) #ethnicity
fit4<-lm(foreign_binary ~ treat_binary, data=data_nonmuslims) #foreigners
fit5<-lm(concern_binary ~ treat_binary, data=data_nonmuslims)
fit6<-lm(message_binary ~ treat_binary, data=data_nonmuslims)
fit7<-lm(trust_rel_binary ~ treat_binary, data=data_nonmuslims)
fit8<-lm(trust_eth_binary ~ treat_binary, data=data_nonmuslims)
reg_list<-list(fit1, fit2, fit3, fit4, fit5, fit7, fit8)
fit1.df<-cbind(as.data.frame(fit1$coefficients), confint(fit1))
fit2.df<-cbind(as.data.frame(fit2$coefficients), confint(fit2))
fit3.df<-cbind(as.data.frame(fit3$coefficients), confint(fit3))
fit4.df<-cbind(as.data.frame(fit4$coefficients), confint(fit4))
fit5.df<-cbind(as.data.frame(fit5$coefficients), confint(fit5))
fit6.df<-cbind(as.data.frame(fit6$coefficients), confint(fit6))
fit7.df<-cbind(as.data.frame(fit7$coefficients), confint(fit7))
fit8.df<-cbind(as.data.frame(fit8$coefficients), confint(fit8))
fit1.df$names<-rownames(fit1.df)
fit1.df$outcome<-"Ethnic vs\nnational id"
fit2.df$names<-rownames(fit2.df)
fit2.df$outcome<-"Neighbor\ndiff religion"
fit3.df$names<-rownames(fit3.df)
fit3.df$outcome<-"Neighbor\ndiff ethnicity"
fit4.df$names<-rownames(fit4.df)
fit4.df$outcome<-"Neighbor\nforeign"
fit5.df$names<-rownames(fit5.df)
fit5.df$outcome<-"Concern about\nextremism"
fit6.df$names<-rownames(fit6.df)
fit6.df$outcome<-"Record\nmessage"
fit7.df$names<-rownames(fit7.df)
fit7.df$outcome<-"Trust other\nreligion"
fit8.df$names<-rownames(fit8.df)
fit8.df$outcome<-"Trust other\nethnicity"
colnames(fit1.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit2.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit3.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit4.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit5.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit6.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit7.df)<-c("coef", "lower", "upper", "names", "outcome")
colnames(fit8.df)<-c("coef", "lower", "upper", "names", "outcome")
all_reg<-bind_rows(fit1.df, fit2.df, fit3.df, fit4.df, fit5.df, fit6.df, fit7.df, fit8.df)
all_reg %<>% filter(!names=="(Intercept)")
all_reg %<>% mutate(outcome=factor(outcome, levels=unique(outcome)))
effects_all_nonmuslims<-all_reg %>% ggplot(aes(x=outcome, y=coef)) + geom_hline(yintercept=0, linetype=2) + geom_point(size=1, position = position_dodge(width=.5)) + geom_errorbar(aes(ymin=lower, ymax=upper), width=.2, position = position_dodge(width=.5)) + scale_y_continuous(limits=c(-.5,.5)) + labs(x="", y="", title="non-Muslim respondents") + coord_flip() + scale_colour_ordinal("Treatment")  + theme(axis.text.y = element_blank())
grid.arrange(effects_all_muslims, effects_all_nonmuslim, nrow=1, ncol=2, widths = 5:4)
grid.arrange(effects_all_muslims, effects_all_nonmuslims, nrow=1, ncol=2, widths = 5:4)
